package com.panopset.gui;

import java.awt.Component;

import javax.swing.JTabbedPane;

import com.panopset.java.Version;
import com.panopset.swing.FontManager;

/**
 * Panopset tabbed pane.
 *
 * @author Karl Dinwiddie
 */
public class TTabbedPane extends JTabbedPane {

    /**
     * Constructor.
     */
    public TTabbedPane() {
        super();
        init();
    }

    /**
     * Constructor.
     *
     * @param newTabPlacement
     *            New tab placement.
     */
    public TTabbedPane(final int newTabPlacement) {
        super(newTabPlacement);
        init();
    }

    /**
     * Initialize.
     */
    private void init() {
        setBackground(LookAndFeel.Colors.BG_COLOR.getColor());
        setForeground(LookAndFeel.Colors.FG_COLOR.getColor());
        FontManager.register(this,
                FontManager.FontType.boldArial);
    }

    @Override
    public final Component add(final Component c) {
        Component rtn = super.add(c);
        setBackgroundAt(getComponentCount() - 1, LookAndFeel.Colors.BG_COLOR
                .getColor());
        return rtn;
    }

    /**
     * Serial version id.
     */
    private static final long serialVersionUID =
        Version.UNI_VERSION;
}
